package com.woniu.user.service;

import com.woniu.user.controller.form.CoachApplyForm;
import com.woniu.user.controller.form.LoginForm;
import com.woniu.user.controller.form.ModifyPwdForm;
import com.woniu.user.controller.form.ModifySelfForm;
import com.woniu.user.controller.form.RegisterForm;
import com.woniu.user.controller.form.*;
import com.woniu.user.model.Account;
import com.baomidou.mybatisplus.extension.service.IService;
import com.woniu.user.service.dto.AccountDto;
import org.springframework.web.multipart.MultipartFile;
import com.woniu.user.service.dto.CoachInfoDto;

import javax.mail.MessagingException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * <p>
 * 用户账号表（学员和教练） 服务类
 * </p>
 *
 * @author Silas
 * @since 2023-02-15
 */
public interface AccountService extends IService<Account> {

    Cookie login(LoginForm loginForm);

    void register(RegisterForm registerForm) throws MessagingException;

    void closeRegister(String mail);

    void active(Integer id);

    void beCoach(int accountFromToken, CoachApplyForm coachApplyForm);

    void modifySelf(Integer userId, ModifySelfForm modifySelfForm);

    void changePwd(Integer userId, ModifyPwdForm form);

    AccountDto getUserInfo(Integer userId);

    String updateProfile(MultipartFile file, Integer userId);

    void modifyCoach(Integer userId, ModifyCoachForm modifyCoachForm);

    CoachInfoDto getCoachInfo(Integer userId);

    void sendCode(String email);

    void sendMail(String addr, String title, String content) throws MessagingException;

    void checkCode(String email, String code);

    void resetPwd(RegisterForm registerForm);

    void checkBalance(Integer userId,BigDecimal money);

    String getUserEmailById(Integer userId);

    void cashOut(Integer userId, CashOutForm form);

    String cashIn(Integer userId, BigDecimal money);

    Map<String, String> convertParams(HttpServletRequest request);

}
